Fix CodeRabbit findings on cricket-scoreboard plugin (PR #181)#184
Conversation
- Require non-empty favorite_teams entries in config schema - Reject negative overs in overs_to_balls - Validate ESPN JSON response is a dict before returning from _get_json - Scope the series discovery cache key by favorite_teams/favorite_competitions - Rename logo_downloader.py -> cricket_logo_downloader.py to avoid cross-plugin module collisions (deferred import from manager.py) - Require HTTPS logo URLs and sanitize team abbreviations before building logo file paths to prevent SSRF/path traversal - Preserve the update lock across on_config_change instead of replacing it via self.__init__(), which broke mutual exclusion with in-flight update()/display() calls Bump version to 1.0.1.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 30 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Summary
Addresses all 7 CodeRabbit findings from #181:
favorite_teamsnow requires non-empty strings (minLength: 1) — an empty entry previously matched every international series via substring matching incricket_data_fetcher.py.overs_to_balls: now rejects negative overs (returns0), matching the existing guard inovers_to_decimal._get_json: validates the parsed response is adictbefore returning it, logging a warning and returningNoneotherwise, so callers can safely use.get(...).favorite_teams/favorite_competitionsfilters, so a config change can no longer serve up to 24h of stale series from the previous configuration.logo_downloader.py→cricket_logo_downloader.py(plugin-unique name per the repo's module-naming rule for deferred imports) and updated the import inmanager.py.download_missing_logonow rejects non-HTTPSlogo_urls, and bothmanager.py(wherelogo_pathis built) andcricket_logo_downloader.pysanitize the team abbreviation to alphanumeric/&/_before it's used in a filename.on_config_change: preservesself._lockacross theself.__init__()re-run instead of replacing it, so a thread already holding the old lock insideupdate()/display()doesn't lose mutual exclusion with callers of the new lock.Bumped
manifest.jsonversion to1.0.1.Test plan
python3 -m py_compile plugins/cricket-scoreboard/*.pypython3 test_cricket_plugin.py— 21/21 passpython scripts/check_module_collisions.py— OKplugins.jsonfor the version bumpNote on PR #182 / #183
Checked whether these same findings apply to the NRL and AFL scoreboard plugins (also opened around the same time, forked from
soccer-scoreboard). They don't — different architecture:abbr in self.favorite_teams), not substring matching, so an empty string can't accidentally match everything the way it could in cricket's series-name matching.src.logo_downloadermodule, not a plugin-local file, so there's no cross-plugin module-collision risk to rename away.on_config_changeimplementations already update state in-place underself._config_lock(draining in-flight update threads) rather than callingself.__init__(), so the lock-replacement bug doesn't exist there.No changes needed on #182/#183 for these specific findings.
Generated by Claude Code